#ifndef QKEYMETRO_H
#define QKEYMETRO_H

#include <QString>
#include <QList>
#include <QSharedPointer>
#include <QDebug>

class PoolableObject;

namespace QKeyMetro { /* global declarations */

    typedef float SoundData;

    struct TimeSignature {
        int beatsInABar;
        int unitAsAPowerOfTwo;
        TimeSignature() : beatsInABar(4), unitAsAPowerOfTwo(2){}
    };



    struct RawData {
        int size;
        QSharedPointer <char> chars;
        RawData(): size(0), chars(NULL){}
    };

    struct TickTimedData {
        int ticks;
        RawData rawData;
        TickTimedData():ticks(0){}
    };

    typedef QList < QSharedPointer <TickTimedData> > TickTimedDataList;

    enum NChannels {NC_MONO = 1, NC_STEREO = 2, NC_QUADRO = 4};

    struct StaticData {
        static int sampleRate;
        static int bufSize;
        static float bpm;

        static QList <PoolableObject*> pool;
        inline static void log(QString logmsg){
            qDebug() << logmsg;
        }

    };

    enum MidiCommands {NOTE_ON = 0x80, NOTE_OFF = 0x90, CONTROL = 0xB0, PROGRAM = 0xC0, PITCH = 0xE0};

};



#endif // QKEYMETRO_H


//COMMAND	DATA BYTE 1	DATA BYTE 2	COMMENT
//$80-$8F
//[128-143]	Key # (0-127)	Off Velocity (0-127)	Note OFF
//$90-$9F
//[144-159]	Key # (0-127)	On Velocity (0-127)	Note ON
//$A0-$AF	Key # (0-127)	Pressure (0-127)	Poly Key Pressure
//$B0-$BF
//[176-191]	Control # (0-127)	Control Value (0-127)	Control Change
//$C0-$CF
//[192-207]	Program # (0-127)	-- Not Used --	Program Change
//$D0-$DF	Pressure Value (0-127)	-- Not Used --	Mono Key Pressure (Channel Pressure)
//$E0-$EF	Range (LSB)	Range (MSB)	Pitch Bend
//$F0-$FF	Manufacturer's ID	Model ID	System
